package com.twu.biblioteca;

import com.twu.biblioteca.libraryitems.Book;
import com.twu.biblioteca.libraryitems.LibraryItem;

import java.util.ArrayList;
import java.util.List;
/**
 * Created by sarahc on 1/8/14.
 */
public class Customer {

    private String libraryNumber;
    private String password;

    private String name;
    private String email;
    private String phone;
    private List<LibraryItem> checkedOutItems;

    public Customer (String name, String libraryNumber, String password, String email, String phone){
        this.name = name;
        this.libraryNumber = libraryNumber;
        this.password = password;
        this.email = email;
        this.phone = phone;
        this.checkedOutItems = new ArrayList<LibraryItem>();
    }

    public String getLibraryNumber(){
        return this.libraryNumber;
    }

    public String getPassword(){
        return this.password;
    }

    public String getName() {
        return this.name;
    }

    public String getEmail(){
        return this.email;
    }

    public String getPhone(){
        return this.phone;
    }

    public void addItem(LibraryItem item){
        this.checkedOutItems.add(item);
    }

    public boolean haveItems(){
        return !checkedOutItems.isEmpty();
    }

    public boolean haveItem(LibraryItem item){
        return checkedOutItems.contains(item);
    }

    public boolean removeItem(LibraryItem item){
        if (checkedOutItems.contains(item)){
            checkedOutItems.remove(item);
            return true;
        }
        return false;
    }
}
